// import { createHashRouter } from "react-router-dom";
import { createBrowserRouter } from 'react-router-dom';
import App from "../App";import Login from "../page/login";
import Article from "../page/Article";
import News from "../page/News";
import Layout from "../page/Layout";
import Board from "../page/Board";
import About from "../page/About";
import Default from "../page/Default";
import NotFound from "../page/NotFound";
import Mqtt from "../page/Mqtt";

const router = createBrowserRouter([
    {
        path: '/',
        element: <App></App>
    },
    {
        path: '/login',
        element: <Login></Login>
    },
    {
        path: '/article',
        element: <Article></Article>
    },
    {
        path: '/mqtt',
        element: <Mqtt></Mqtt>
    },
    {
        path: '/news/:id/:name',
        element: <News></News>
    },
    {
        // 嵌套路由
        path: '/layout',
        element: <Layout></Layout>,
        children: [
            {
                index: true,
                element: <Default></Default>
            },
            {
                path: 'board',
                element: <Board></Board>
            },
            {
                path: 'about',
                element: <About></About>
            }
        ]
    },
    {
        path: '*',
        element: <NotFound />
    }
]);

export default router;